﻿Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Data

Namespace DataAccess
    Public Class RatingData
        Public Shared Function LoadBySite(ByVal _Rating As ModelLayer.IRating) As DataTable
            Using oDm As New DataManager()
                oDm.CommandType = CommandType.StoredProcedure
                oDm.Add("@Website_Name", SqlDbType.NVarChar, 50, _Rating.Website_Name)
                Return oDm.ExecuteDataTable("stp_GetAllcomments")
            End Using
        End Function

        Public Shared Sub Save(ByVal _Rating As ModelLayer.IRating)
            Using oDm As New DataManager()
                oDm.CommandType = CommandType.StoredProcedure
                oDm.Add("@Website_Name", SqlDbType.NVarChar, 50, _Rating.Website_Name)
                oDm.Add("@Username ", SqlDbType.NVarChar, 50, _Rating.Username)
                oDm.Add("@Rating ", SqlDbType.SmallInt, _Rating.Rating)
                oDm.Add("@Comments ", SqlDbType.NVarChar, 500, _Rating.Comments)
                oDm.Add("@IPAddress", SqlDbType.NChar, 15, _Rating.IPAddress)
                oDm.ExecuteNonQuery("stp_Addcomments")
            End Using
        End Sub
    End Class
End Namespace